let fs = require("fs");

function read(url){
    return new Promise((resolve,reject)=>{
        fs.readFile(url,(err,data)=>{
            if(!err){
                resolve(data);  //修改promise为成功状态，并将读取文件内容保存到对象中
            }else{
                reject(err);    //修改为失败状态并将错误消息保存到promise对象中
            }
        })
    })
}


async function fn(){
    let a = await read("./01.txt");
    console.log(a.toString("utf-8"));
    let b = await read("./02.txt");
    console.log(b.toString("utf-8"));
    let c = await read("./03.txt");
    console.log(c.toString("utf-8"));
}

fn();